﻿using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;

namespace CommonUtils
{
    public static class HtmlContent
    {
        public static IHtmlContent RelocalMeta(this IHtmlHelper htmlHelper, string url)
        => htmlHelper.Raw(HtmlUtil.GetRelocalMeta(url));

        public static IHtmlContent Parse(string value)
        => new HtmlString(value);

        public static IHtmlContent ToHtmlContent(this string value)
        => new HtmlString(value);

        public static IHtmlContent ToHtmlToContent(this string text)
        => text.ToHtml().ToHtmlContent();

        public static IHtmlContent GetRelocalMeta(string url)
        => Parse(HtmlUtil.GetRelocalMeta(url));

        public static readonly IHtmlContent Utf8Meta = Parse(HtmlUtil.CharsetMeta);

        public static readonly IHtmlContent ViewPortScaleMeta = Parse(HtmlUtil.ViewPortScaleMeta);

        public static IHtmlContent GetIconLink(string path)
        => Parse(HtmlUtil.GetIconLink(path));
    }
}
